import Network from "../utils/network"

const register = (registerInfo:{username:string,password:string}) => {
    return Network.post("/users/register",{
        params:{
            "username":registerInfo.username,
            "password":registerInfo.password
        }
    })
}

const login = (loginInfo:{username:string,password:string})=> {
   return Network.post("/users/login",{
        params:{
            "username":loginInfo.username,
            "password":loginInfo.password
        }
    })
}

const updateAvatar = (userid:string,avatar:string) => {
    return Network.post("/users/updateAvatar",{params:{
        userid,
        avatar
    }})
}

const UserService = {
    register,
    login,
    updateAvatar
}
export default UserService;